package com.example.anju.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.anju.entity.Information;
import com.example.anju.entity.Result;
import com.example.anju.entity.ViewInformationHouse;
import com.example.anju.mapper.ViewInformationHouseMapper;

@Service
public class ViewInformationHouseService {
	@Autowired
	private ViewInformationHouseMapper viewInformationHouseMapper;

	// 查看个人信息
	public Result findInformationHouseByHouseId(ViewInformationHouse viewInformationHouse) {
		Result result = new Result();
		result.setSuccess(false);
		result.setDatas(null);
		try {
			List<ViewInformationHouse> informationHouseByHouseId = viewInformationHouseMapper
					.findInformationHouseByHouseId(viewInformationHouse.getHouse_id());
			if (informationHouseByHouseId.isEmpty()) {
				result.setMessage("个人和房源信息为空");
			} else {
				result.setMessage("个人和房源信息查询成功");
				result.setSuccess(true);
				result.setDatas(informationHouseByHouseId);
			}
		} catch (Exception e) {
			result.setMessage(e.getMessage());
			e.printStackTrace();
		}
		return result;
	}
}
